home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 08 - 1992 / 08.06 Oct 92 / One-Application Patches / wrap icon.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-08  |  1.3 KB  |  60 lines  |  [TEXT/KAHL]

  1. /*    ------------------------------------------
  2.         wrap icon.c
  3.         
  4.         THINK C "Set Project Type..." settings:
  5.         code resource, type 'OAPd', ID 1000,
  6.         custom header, preloaded and locked,
  7.         file type 'rsrc', file creator 'RSED'.
  8.         ------------------------------------------
  9. */
  10. #include "defs.h"
  11.  
  12. void main( WindowPeek the_window );
  13.  
  14. void main( WindowPeek the_window )
  15. {
  16.     BitMap    icon_map;
  17.     long        bits[4];
  18.     Rect        dest;
  19.     GrafPtr    wmgr_port;
  20.     Boolean    **wrapping;
  21.     
  22.     if (!the_window->visible || !the_window->hilited
  23.         || !the_window->goAwayFlag)
  24.         return;
  25.     
  26.     wrapping = (Boolean **)GetResource('OAP1', 128);
  27.     if (wrapping != NIL)
  28.     {
  29.         icon_map.rowBytes = 2;
  30.         icon_map.baseAddr = (Ptr) &bits;
  31.         icon_map.bounds.top = icon_map.bounds.left
  32.                 = 0;
  33.         icon_map.bounds.right
  34.                 = icon_map.bounds.bottom
  35.                 = 8;
  36.         if (**wrapping)
  37.         {
  38.             bits[0] = 0x00000000L;
  39.             bits[1] = 0xFC000400L;
  40.             bits[2] = 0x04001500L;
  41.             bits[3] = 0x0E000400L;
  42.         }
  43.         else                    // not wrapping
  44.         {
  45.             bits[0] = 0x04000200L;
  46.             bits[1] = 0xFF000200L;
  47.             bits[2] = 0x04000000L;
  48.             bits[3] = 0x00000000L;
  49.         }
  50.         dest = (**(the_window->strucRgn)).rgnBBox;
  51.         dest.left += 22;
  52.         dest.top += 6;
  53.         dest.right = dest.left + 8;
  54.         dest.bottom = dest.top + 8;
  55.         GetPort( &wmgr_port );
  56.         CopyBits( &icon_map, &wmgr_port->portBits,
  57.             &icon_map.bounds, &dest, srcCopy, NIL );
  58.     }
  59. }
  60.